<#import "../common/common.ftl" as common />
<@common.page>
	<!-- Classes -->
	<script type="text/javascript" src="${res}/js/ui/check.BaseDataQualityQuery.js"></script>
	<!-- ux	-->
	
	<script type="text/javascript">
		check.ConsistencyDataQuery = Ext.extend(check.BaseDataQualityQuery, {
			gridViewConfig: {},
		    pageSize: EXT_PAGE_SIZE,
		    sm: new Ext.grid.RowSelectionModel({
				//dataIndex: this.ID
			}),
			
			initGridPanel: null,
			//penal1
		    store1: null,
		    storeMapping1: ["comcode","comcname","checkpoint","checkpointname","wrongcnt_a","wrongcnt_b","wcje","mybl"],
		    grid1:null,
		    cm1: new Ext.grid.CellSelectionModel(),
		    
		    //penal3
		    store3: null,
		    storeMapping3: ["checkpoint","checkpointname","wrongcnt_a","wrongcnt_b","wcje","mybl"],
		    grid3:null,
		    cm3: new Ext.grid.CellSelectionModel(),
		    
			
			constructor: function(config) {
				config = config || {};
				
				this.pageSize = config.pageSize || EXT_PAGE_SIZE;
		        
		        var viewConfig = Ext.apply({
		            forceFit: true
		        }, this.gridViewConfig);
		        
		        if(this.view){
		            Ext.apply(this.gridPanel,{
		                view: this.view
		            });
		        };
		        
		        /**********************************grid1***************************/
		        this.cm1.defaultSortable = true;
		        
		        this.cm1 = new Ext.grid.ColumnModel([
		            new Ext.grid.RowNumberer(),
				    {
				        header:"公司代码",
				        dataIndex:"comcode",
				        align:'center',
				        style:'font-weight:bold;',
		                sortable:true
			        },{
				        header:"公司名称",
				        dataIndex:"comcname",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"检查点代码",
				        dataIndex:"checkpoint",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"检查点名称",
				        dataIndex:"checkpointname",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"系统一",
				        dataIndex:"wrongcnt_a",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"系统二",
				        dataIndex:"wrongcnt_b",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"误差金额",
				        dataIndex:"wcje",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"错误比率%",
				        width:80,
				        style:'font-weight:bold;',
				        align:'center',
				        dataIndex:"mybl",
		                sortable:true
			        }
			    ]);
		        
		        this.store1 = new Ext.data.JsonStore({
	                id: this.ID,
	                url: AJAX_ROOT_URL+"/dataquality/queryConsistencyInCompany",
	                root: EXT_STORE_ROOT,
	                totalProperty: EXT_STORE_TOTALPROPERTY,
	                remoteSort: true,
	                fields: this.storeMapping1
	            });
		        
		        this.grid1 = new Ext.grid.GridPanel({
		            id:Ext.id(),
		            store:this.store1,
		            cm:this.cm1,
		            sm:this.sm,
		            //autoHeight:true,
		            //height:600,
		            trackMouseOver:false,
		            labelStyle:'font-weight:bold;',
		            anchor:'100%',
		            loadMask: true,
				    autoScroll:true,
				    border:false,
				    //collapsible: true,
		            animCollapse:false,
		            viewConfig:{
		            	forceFit: true
		            },
		            listeners: {
		                'contextmenu':function(e) {
		                    e.stopEvent();
		                },
		                'cellcontextmenu':function(Grid,Rindex,Cindex,E){
					    }
		            },
		            bbar: new Ext.PagingToolbar({
		                pageSize: this.pageSize,
		                store: this.store1,
		                buttonAlign:'right'
		            })
		        });
		        
		        /**********************************grid3***************************/
		        this.cm3.defaultSortable = true;
		        
		        this.cm3 = new Ext.grid.ColumnModel([
		            new Ext.grid.RowNumberer(),
				    {
				        header:"检查点代码",
				        dataIndex:"checkpoint",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"检查点名称",
				        dataIndex:"checkpointname",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"系统一",
				        dataIndex:"wrongcnt_a",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"系统二",
				        dataIndex:"wrongcnt_b",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"误差金额",
				        dataIndex:"wcje",
				        align:'center',
		                sortable:true,
		                style:'font-weight:bold;'
			        },{
				        header:"错误比率%",
				        width:80,
				        style:'font-weight:bold;',
				        align:'center',
				        dataIndex:"mybl",
		                sortable:true
			        }
			    ]);
		        
		        this.store3 = new Ext.data.JsonStore({
	                id: this.ID,
	                url: AJAX_ROOT_URL+"/dataquality/queryConsistencyInCheckPoint",
	                root: EXT_STORE_ROOT,
	                totalProperty: EXT_STORE_TOTALPROPERTY,
	                remoteSort: true,
	                fields: this.storeMapping3
	            });
		        
		        this.grid3 = new Ext.grid.GridPanel({
		            id:Ext.id(),
		            store:this.store3,
		            cm:this.cm3,
		            sm:this.sm,
		            //autoHeight:true,
		            //height:600,
		            trackMouseOver:false,
		            labelStyle:'font-weight:bold;',
		            anchor:'100%',
		            loadMask: true,
				    autoScroll:true,
				    border:false,
				    //collapsible: true,
		            animCollapse:false,
		            viewConfig:{
		            	forceFit: true
		            },
		            listeners: {
		                'contextmenu':function(e) {
		                    e.stopEvent();
		                },
		                'cellcontextmenu':function(Grid,Rindex,Cindex,E){
					    }
		            },
		            bbar: new Ext.PagingToolbar({
		                pageSize: this.pageSize,
		                store: this.store3,
		                buttonAlign:'right'
		            })
		        });
		        
		    	this.initGridPanel = new Ext.TabPanel({
			    	activeTab: 0,
			    	items:[{
			    		title:'公司维度', 
			    		autoHeight:true,    
		               	autoWidth:true,    
		               	autoScroll:true,    
		              	frame:true, 
			    		items:this.grid1,
			    		listeners:{
	    					'afterlayout': function() {
								this.grid1.setHeight(document.body.clientHeight - 265);
	    					},
	    					scope:this
			    		}
		    		},{
		    			title:'检查点维度', 
		    			autoHeight:true,    
		               	autoWidth:true,    
		               	autoScroll:true,    
		              	frame:true, 
			    		items:this.grid3,
			    		listeners:{
	    					'afterlayout': function() {
								this.grid3.setHeight(document.body.clientHeight - 265);
	    					},
	    					scope:this
			    		}
	    			}]
			    });
		    	
		    	var configs = Ext.apply({
		    		
		        },config);
		    	
		    	check.ConsistencyDataQuery.superclass.constructor.call(this,configs);
			},
		    //点击查询按钮
		    onSearch: function(){
		    	var pageParam = {
		    		'start': 0,
	                'limit': this.pageSize
		    	};
		    	this.store1.setBaseParam('checkDate', Ext.getCmp('checkDate').getValue());
		    	this.store1.setBaseParam('product', Ext.getCmp('product').getValue());
		    	this.store1.setBaseParam('comcode', Ext.getCmp('comcode').data.comcode);
		    	this.store1.setBaseParam('gradeLevel', Ext.getCmp('comcode').data.gradelevel);
		    	this.store1.setBaseParam('checkPoint', Ext.getCmp('checkPoint').getValue());
		    	
		    	this.store3.setBaseParam('checkDate', Ext.getCmp('checkDate').getValue());
		    	this.store3.setBaseParam('product', Ext.getCmp('product').getValue());
		    	this.store3.setBaseParam('comcode', Ext.getCmp('comcode').data.comcode);
		    	this.store3.setBaseParam('gradeLevel', Ext.getCmp('comcode').data.gradelevel);
		    	this.store3.setBaseParam('checkPoint', Ext.getCmp('checkPoint').getValue());
		    	
				this.store1.load({
		            params: pageParam
		        });
				this.store3.load({
		            params: pageParam
		        });
			}
		});
		
		Ext.onReady(function(){
			var reportQuery = new check.ConsistencyDataQuery({
				needCheckPoint:true,
				isConsistency:'true',
				userCompany: {${userCompany}},
				renderTo:Ext.getBody()
			});
		});
	</script>
	</head>
<body style="background-color:transparent">
</body>
</@common.page>